import { Tools } from 'weaver-mobile';
import { catchApiError } from '../util/index';
import { PARAMS } from '../components/public/BlogUtils';


// 新增或修改微博信息
export const saveOrUpdateBlog = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/base/saveOrUpdateBlog',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 新增或修改微博信息
export const getBlogByUserDate = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getBlogByUserDate',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}


// 新增或修改微博信息
export const getBlogById = params => {
    let options = {
        method: 'GET',
        url: '/api/blog/base/getBlogById',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}

// 获取微博应用列表
export const getBlogAppList = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getBlogAppList',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 获取微博@at设置
export const getBlogAtConfig = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getBlogAtConfig',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

export const saveBlogNote = params => {
    let options = {
        method: 'POST',
        url: '/api/blog/base/saveBlogNote',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}


export const saveBlogNoteByInterval = params => {
    let options = {
        method: 'POST',
        url: '/api/blog/base/saveBlogNoteByInterval',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}

export const getTimerByNote = params => {
    let options = {
        method: 'POST',
        url: '/api/blog/base/getTimerByNote',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}

export const getIsOneSubmitInfo = params => {
    let options = {
        method: 'POST',
        url: '/api/blog/base/getIsOneSubmitInfo',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}

export const getBlogNote = params => {
    let options = {
        method: 'GET',
        url: '/api/blog/base/getBlogNote',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}




export const getBlogNoteEcmeinfo = params => {
    let options = {
        method: 'GET',
        url: '/api/blog/myblog/getblognoteecme',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}

export const getBlogEcmeInfo = params => {
    let options = {
        method: 'GET',
        url: '/api/blog/myblog/getblogecmeparme',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}

export const saveBlogEcmeInfo = params => {
    let options = {
        method: 'POST',
        url: '/api/blog/myblog/saveblogecme',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}

export const saveBlogNoteEcmeinfo = params => {
    let options = {
        method: 'POST',
        url: '/api/blog/myblog/saveblognoteecme',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}


export const updateBlogEcmeinfo = params => {
    let options = {
        method: 'POST',
        url: '/api/blog/myblog/updateblogecme',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}




